<?php
namespace app\serverfund\service\integral;
use app\manage\service\ApiBase;
/**
 * @author:      李颖
 * @DateTime:    2017-11-05 16:41:09
 * @Description: 后台 - 积分派发
 */
class IntegralDistribute extends ApiBase
{
    protected $integralDistributeValidate = '\app\serverfund\validate\IntegralDistribute';
	protected $integralDistributeLogic = '\app\serverfund\logic\IntegralDistribute';
    use \app\serveruser\traits\AddAppIdToRunOne;

    /*添加资金派发积分的记录*/
    public function add(): array 
    {
    	$data = $this->haveIssetReceiveData(['other_app_read'=>'', 'is_public'=>' ', 'fund_type'=>' ', 'fund'=>0, 'integral'=>0, 'remark'=>'', 'token'=>' '], []);
    	/*return $this->_addAppIdToRunOne($data, 'serverfund/integral/IntegralDistribute/add', $this->integralDistributeValidate, $this->integralDistributeLogic);*/
        return $this->stepRun($data, 'serveruser/auth/Token/hGetAll,serveruser/auth/App/find,serverfund/integral/IntegralDistribute/add', '', 'add', '1', $this->integralDistributeValidate, $this->integralDistributeLogic);
    }

    public function list(): array 
    {
        $data = $this->haveIssetReceiveData(['page'=>1, 'listRows'=>15, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverfund/integral/IntegralDistribute/list', $this->integralDistributeValidate, $this->integralDistributeLogic);
    }

    /*后台管理员一键派发积分*/
    public function oneKeyDistribute(): array 
    {
        $data = $this->haveIssetReceiveData(['certificate_ids'=>'', 'distribute_time'=>'', 'token'=>' ']);
        return $this->stepRun($data, 'serveruser/auth/Token/hGetAll,serveruser/auth/App/find,servercertificate/certificate/Certificate/getCertiListByIds,serverfund/integral/IntegralDistribute/getOneNew,servercertificate/certificate/Certificate/integralDistribute,serverfund/integral/IntegralAccount/prepaidByUids', '', 'oneKeyDistribute', '1', $this->integralDistributeValidate, $this->integralDistributeLogic);
    }

    /*后台管理员获取派发积分分页列表*/
    public function getDistributePageList(): array 
    {
        $data = $this->haveIssetReceiveData(['distribute_date'=>'', 'keywords'=>'', 'status'=>'','certificate_id'=>'', 'page'=>1, 'listRows'=>15], []);
        return $this->oneStepRun($data, 'servercertificate/certificate/Certificate/getDistributePageList', '', '1', $this->integralDistributeValidate, $this->integralDistributeLogic);
    }

    

    

}